package com.sync.data.mce.repository;

import com.sync.data.mce.entity.MdmHcp;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 卫生保健从业人员信息表服务接口
 *
 * @author zxr
 * @since 2024-08-05 18:50:31
 */
@Repository
public interface MdmHcpRepository extends JpaRepository<MdmHcp, String>, JpaSpecificationExecutor<MdmHcp> {

    MdmHcp findEntityByHcpCode(String hcpCode);

    List<MdmHcp> findEntitiesByHcoIdIn(List<String> hcoId);

    @Modifying
    @Query("update MdmHcp u set u.hcpIsSpeaker =:hcpIsSpeaker where u.id = :id  ")
    void updateHcpIsSpeakerById(String hcpIsSpeaker, String id);

    boolean existsMdmHcpByHcpCode(String hcpCode);

}
